home *** CD-ROM | disk | FTP | other *** search
- property ancestor, pTextChannel, pSelectionSprite, pSelection, pMember, pLineHeight, pVisibleLines
-
- on new me, bedChannel, textChannel, selectionChannel, descendant
- pBedChannel = bedChannel
- pTextChannel = textChannel
- pSelectionSprite = selectionChannel
- pSelection = 0
- pMember = the member of sprite textChannel
- pLineHeight = the textHeight of member pMember
- pVisibleLines = integer(float(member(pMember).pageHeight) / pLineHeight)
- minVal = 1
- maxVal = max(1, the number of lines in field pMember - 1)
- value = 1
- if voidp(descendant) then
- descendant = me
- end if
- ancestor = new(script("scroll bar"), bedChannel, textChannel, minVal, maxVal, value, pVisibleLines, descendant)
- return me
- end
-
- on Inscope me
- puppetSprite(pSelectionSprite, 1)
- Inscope(ancestor)
- end
-
- on outScope me
- puppetSprite(pSelectionSprite, 0)
- outScope(ancestor)
- end
-
- on adjustScrollbar me
- setSelection(me, 0)
- SetNumSettings(me, max(1, the number of lines in field pMember - pVisibleLines + 1))
- end
-
- on setThumb me, NewSetting
- if NewSetting < me.pMin then
- NewSetting = me.pMin
- end if
- if NewSetting > me.pMax then
- NewSetting = me.pMax
- end if
- setThumb(ancestor, NewSetting)
- updateSelection(me)
- end
-
- on performFunction me
- member(pMember).scrollTop = pLineHeight * (me.pSetting - 1)
- updateSelection(me)
- end
-
- on setSelection me, selection
- pSelection = selection
- updateSelection(me)
- end
-
- on getSelection me
- return pSelection
- end
-
- on updateSelection me
- if pSelection = 0 then
- set the locV of sprite pSelectionSprite to -9999
- else
- lineLoc = linePosToLocV(member(pMember), pSelection) + the top of sprite pTextChannel - member(pMember).scrollTop + integer(member(pMember).margin / 2)
- top = the top of sprite pTextChannel
- bot = the bottom of sprite pTextChannel
- height = the height of sprite pSelectionSprite
- if (lineLoc >= top) and ((lineLoc + height) <= bot) then
- set the locV of sprite pSelectionSprite to lineLoc
- else
- set the locV of sprite pSelectionSprite to -9999
- end if
- end if
- updateStage()
- end
-
- on GetHiliteAdjustment me, clickedLine
- if the machineType = 256 then
- return 4 - (clickedLine * 2)
- else
- return 0
- end if
- end
-